#include <iostream>
#include "event.hpp"

violated::eventManager::eventManager(sf::Window *AppPtr)
{
  App = AppPtr;
  event = new sf::Event;
  status = true;
}

bool violated::eventManager::isRuning()
{
  return (status);
}

void violated::eventManager::action()
{
  while (App->GetEvent(*event))
    {
      if (event->Type == sf::Event::Resized)
        {
	  std::cout << "resising !!" << std::endl;
          glViewport(0, 0, event->Size.Width, event->Size.Height);
	}
      else if (event->Type == sf::Event::Closed)
	status = false;
      else if (event->Type == sf::Event::KeyPressed)
        {
	  std::cout<<"key pressed !"<<std::endl;
          if (event->Key.Code == sf::Key::Escape)
	    status = false;
	}
    }  
  return;
}
